package com.blb.blb_erp.util;

import org.apache.shiro.codec.Base64;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import java.security.NoSuchAlgorithmException;

public class CodeDemo {

    public static void main(String[] args) throws NoSuchAlgorithmException {
        SimpleHash md5 = new SimpleHash("md5", "123456",
                ByteSource.Util.bytes("894fa7b9796a438a82c3d124b2e5b123"), 10);
        System.out.println(md5);

        KeyGenerator keygen = KeyGenerator.getInstance("AES");
        SecretKey deskey = keygen.generateKey();
        System.out.println(Base64.encodeToString(deskey.getEncoded()));
    }
}
